const express = require('express')
const path = require('path')
const app = express();
//处理body中间件
app.use(express.urlencoded());
app.use(express.json());

// 引入封装的路由
const adminListRoute = require("./routes/adminList");
const addAdminRoutes = require('./routes/addAdmin')
const deleteAdminRoutes = require('./routes/deleteAdmin')
const loginRoutes = require('./routes/login')
const isLogin = require('./routes/islogin')
const logout = require('./routes/logout')
const addAdv = require('./routes/addAdv')
const advList = require('./routes/advList')

app.use("/upload",express.static(path.resolve(__dirname,"./upload/")))
require('./db')
app.use(deleteAdminRoutes)
app.use(addAdminRoutes)
app.use(adminListRoute)
app.use(loginRoutes)
app.use(isLogin)
app.use(logout)
app.use(addAdv)
app.use(advList)
// app.get('/advLis',(req,res)=>{
//     console.log('kkk');
// })

app.listen(3000, () => console.log('服务器启动成功'))